namespace PraceDyplomowe2.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.PoziomStudiows",
                c => new
                    {
                        PoziomStudiowID = c.Int(nullable: false, identity: true),
                        Nazwa = c.String(),
                    })
                .PrimaryKey(t => t.PoziomStudiowID);
            
            CreateTable(
                "dbo.PromotorTemats",
                c => new
                    {
                        PromotorTematID = c.Int(nullable: false, identity: true),
                        Promotor_PromotorID = c.Int(),
                    })
                .PrimaryKey(t => t.PromotorTematID)
                .ForeignKey("dbo.Promotors", t => t.Promotor_PromotorID)
                .Index(t => t.Promotor_PromotorID);
            
            CreateTable(
                "dbo.Promotors",
                c => new
                    {
                        PromotorID = c.Int(nullable: false, identity: true),
                        Imie = c.String(),
                        Nazwisko = c.String(),
                        NrTelefonu = c.String(),
                        Email = c.String(),
                        Zainteresowania = c.String(),
                        Konsultacje = c.String(),
                        Publikacje = c.String(),
                        Zdjecie = c.String(),
                        Rola_RolaId = c.Int(),
                        Wydzial_WydzialID = c.Int(),
                    })
                .PrimaryKey(t => t.PromotorID)
                .ForeignKey("dbo.Rolas", t => t.Rola_RolaId)
                .ForeignKey("dbo.Wydzials", t => t.Wydzial_WydzialID)
                .Index(t => t.Rola_RolaId)
                .Index(t => t.Wydzial_WydzialID);
            
            CreateTable(
                "dbo.Rolas",
                c => new
                    {
                        RolaId = c.Int(nullable: false, identity: true),
                        Nazwa = c.String(),
                    })
                .PrimaryKey(t => t.RolaId);
            
            CreateTable(
                "dbo.Wydzials",
                c => new
                    {
                        WydzialID = c.Int(nullable: false, identity: true),
                        Nazwa = c.String(),
                    })
                .PrimaryKey(t => t.WydzialID);
            
            CreateTable(
                "dbo.StatusPromotors",
                c => new
                    {
                        StatusPromotorID = c.Int(nullable: false, identity: true),
                        Nazwa = c.String(),
                    })
                .PrimaryKey(t => t.StatusPromotorID);
            
            CreateTable(
                "dbo.StatusStudents",
                c => new
                    {
                        StatusStudentID = c.Int(nullable: false, identity: true),
                        Nazwa = c.String(),
                    })
                .PrimaryKey(t => t.StatusStudentID);
            
            CreateTable(
                "dbo.Temats",
                c => new
                    {
                        TematID = c.Int(nullable: false, identity: true),
                        PolskiTytul = c.String(),
                        AngielskiTytul = c.String(),
                        Opis = c.String(),
                        Bibliografia = c.String(),
                        Promotor_PromotorID = c.Int(),
                        Wydzial_WydzialID = c.Int(),
                        StatusPromotor_StatusPromotorID = c.Int(),
                        StatusStudent_StatusStudentID = c.Int(),
                        PoziomStudiow_PoziomStudiowID = c.Int(),
                    })
                .PrimaryKey(t => t.TematID)
                .ForeignKey("dbo.Promotors", t => t.Promotor_PromotorID)
                .ForeignKey("dbo.Wydzials", t => t.Wydzial_WydzialID)
                .ForeignKey("dbo.StatusPromotors", t => t.StatusPromotor_StatusPromotorID)
                .ForeignKey("dbo.StatusStudents", t => t.StatusStudent_StatusStudentID)
                .ForeignKey("dbo.PoziomStudiows", t => t.PoziomStudiow_PoziomStudiowID)
                .Index(t => t.Promotor_PromotorID)
                .Index(t => t.Wydzial_WydzialID)
                .Index(t => t.StatusPromotor_StatusPromotorID)
                .Index(t => t.StatusStudent_StatusStudentID)
                .Index(t => t.PoziomStudiow_PoziomStudiowID);
            
            CreateTable(
                "dbo.KierunekStudiows",
                c => new
                    {
                        KierunekStudiowID = c.Int(nullable: false, identity: true),
                        Nazwa = c.String(),
                        Wydzial_WydzialID = c.Int(),
                    })
                .PrimaryKey(t => t.KierunekStudiowID)
                .ForeignKey("dbo.Wydzials", t => t.Wydzial_WydzialID)
                .Index(t => t.Wydzial_WydzialID);
            
            CreateTable(
                "dbo.UserProfile",
                c => new
                    {
                        UserId = c.Int(nullable: false, identity: true),
                        UserName = c.String(),
                    })
                .PrimaryKey(t => t.UserId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.KierunekStudiows", new[] { "Wydzial_WydzialID" });
            DropIndex("dbo.Temats", new[] { "PoziomStudiow_PoziomStudiowID" });
            DropIndex("dbo.Temats", new[] { "StatusStudent_StatusStudentID" });
            DropIndex("dbo.Temats", new[] { "StatusPromotor_StatusPromotorID" });
            DropIndex("dbo.Temats", new[] { "Wydzial_WydzialID" });
            DropIndex("dbo.Temats", new[] { "Promotor_PromotorID" });
            DropIndex("dbo.Promotors", new[] { "Wydzial_WydzialID" });
            DropIndex("dbo.Promotors", new[] { "Rola_RolaId" });
            DropIndex("dbo.PromotorTemats", new[] { "Promotor_PromotorID" });
            DropForeignKey("dbo.KierunekStudiows", "Wydzial_WydzialID", "dbo.Wydzials");
            DropForeignKey("dbo.Temats", "PoziomStudiow_PoziomStudiowID", "dbo.PoziomStudiows");
            DropForeignKey("dbo.Temats", "StatusStudent_StatusStudentID", "dbo.StatusStudents");
            DropForeignKey("dbo.Temats", "StatusPromotor_StatusPromotorID", "dbo.StatusPromotors");
            DropForeignKey("dbo.Temats", "Wydzial_WydzialID", "dbo.Wydzials");
            DropForeignKey("dbo.Temats", "Promotor_PromotorID", "dbo.Promotors");
            DropForeignKey("dbo.Promotors", "Wydzial_WydzialID", "dbo.Wydzials");
            DropForeignKey("dbo.Promotors", "Rola_RolaId", "dbo.Rolas");
            DropForeignKey("dbo.PromotorTemats", "Promotor_PromotorID", "dbo.Promotors");
            DropTable("dbo.UserProfile");
            DropTable("dbo.KierunekStudiows");
            DropTable("dbo.Temats");
            DropTable("dbo.StatusStudents");
            DropTable("dbo.StatusPromotors");
            DropTable("dbo.Wydzials");
            DropTable("dbo.Rolas");
            DropTable("dbo.Promotors");
            DropTable("dbo.PromotorTemats");
            DropTable("dbo.PoziomStudiows");
        }
    }
}
